import common from './public.js'
$(function () {
	/* $("#forget").click(function(){
		common.post(
			'/account/update/password.do',
			{
				userAccount: $("#forget-account").val(),
				userPassword: $("#forget-password").val(),
				userCheckPassword: $("#forget-check-password").val(),
				verificationCode: $("#forget-verification-code").val(),
				verificationCodeUuid: window.sessionStorage.getItem("forget-verification-code-uuid"),
				method: "updatePassword"
				
			},
			function (res) {
				 if(res.success){
					 common.promptSuccess("密码已发送到你的邮箱，注意查收")
				 }else{
					 common.promptError(res.msg)
				 }
				
			}
		)
	}) */
	/* $("#get-verification-code").click(function(){
		$("#forget-account").attr("disable", "disable"),
		$("#forget-email").attr("disable", "disable"),
		common.post(
			'/account/verificationCode/get.do',
			{
				userAccount: $("#forget-account").val(),
				userEmail: $("#forget-email").val(),
				method: "get"
			},
			function (res) {
				 if(res.code === 200){
					window.sessionStorage.setItem("forget-verification-code-uuid", res.data)
					common.promptSuccess(res.msg)
				 }else{
					$("#forget-account").removeAttr("disable"),
					$("#forget-email").removeAttr("disable"),
					 common.promptError(res.msg)
				 }
				
			}
		)
	}) */
	$("#btn-login").click(function(){
		common.post(
			'/login.do',
			{
				code: $("#login-code").val(),
				password: $("#login-password").val()
			},
			function (res) {
				 if(res.code === 200){
					 common.promptSuccess(res.msg)
					 common.diyForm(common.baseUrl + "/user/oneself.do", "POST", {"token": window.localStorage.getItem("token")})
					 // window.location = common.baseUrl + "/oneself.do"
				 }else{
					 common.promptError(res.msg)
				 }
				
			}
		)
	})
});